package com.dmyang.user.controller;

import com.dmyang.user.entity.Teacher;
import com.dmyang.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by brss on 2017/7/20.
 */
@Controller
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("index")
    public String index(){

        return "index";
    }
    @RequestMapping("add")
    @ResponseBody
    public String addTeacher(){
        Teacher teacher = new Teacher();
        teacher.setTname("xiaoliu");
        teacher.setTid(18);
        teacher.setTage(23);
        userService.createTeacher(teacher);
        return "succ";
    }


    @RequestMapping("query")
    @ResponseBody
    public String query(){

        userService.query();
        return "hhaha";
    }


}
